body {
  padding-bottom: constant(34px);
}

@supports (bottom:constant(34px)) {
  div {
    margin-bottom: constant(34px);
  }
}

/*//根据实际情况选择适配方法  给body加类名  'iphonex'*/
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
  .iphonex {
    padding-top: 44px;
    padding-bottom: 34px;
  }

  .iphonex:before {
    content: '';
    display: block;
    position: fixed;
    width: 100%;
    height: 44px;
    background-color: #fff;
    top: 0;
    left: 0;
    z-index: 9999;
  }

  .iphonex:after {
    content: '';
    display: block;
    position: fixed;
    width: 100%;
    height: 34px;
    bottom: 0;
    left: 0;
    z-index: 9999;
  }
}